package com.itheima.mapper;

import com.itheima.pojo.*;
import lombok.Data;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author YangJiaHao
 */
@Mapper
public interface OrderMapper {

    List<Order> page(@Param("beginTime") LocalDateTime beginTime,
                     @Param("endTime")LocalDateTime endTime,
                     @Param("number")String number,
                     @Param("start")Integer start,
                     @Param("pageSize")Integer pageSize);

    Long countOrder();

    Integer updateStatus(@Param("status") Integer status, @Param("id") String id);

    User selectUserByUserId(@Param("userId") String userId);

    AddressBook selectAddressBookById(@Param("addressBookId") String addressBookId);

    List<ShoppingCart> selectShoppingCartByUserId(@Param("userId") String userId);

    Integer inertOrder(@Param("order") Order order);

    void insertOrderDetail(@Param("id") String id,@Param("orderId") String orderId,@Param("name") String name, @Param("number") Integer number);

    List<Order> selectOrderPage(@Param("start") Integer start, @Param("pageSize") Integer pageSize);

    List<OrderDetail> selectOrderDetailsByOrderId(@Param("orderId") String orderId);
}
